home *** CD-ROM | disk | FTP | other *** search
- Path: admaix.sunydutchess.edu!ub!newserve!rebecca!rpi!not-for-mail
- From: floydb1@lib104.its.rpi.edu (Barry B Floyd)
- Newsgroups: comp.lang.c++
- Subject: Re: strstream destruction
- Date: 1 Apr 1996 11:01:01 -0500
- Organization: Rensselaer Polytechnic Institute, Troy, NY.
- Message-ID: <4joujt$72p@lib104.its.rpi.edu>
- References: <315AD92C.726D@itd.ssb.com> <4jhgt0$17f@piper.logicon.com>
- NNTP-Posting-Host: lib104.its.rpi.edu
- X-newsreader: xrn 7.04-beta-11
-
-
- This works for me:
-
- String StrStrFunc ( void ) // some function using strstream
- {
- ostrstream a_stream ; //
- String a_string ; // a 'string' class (char *)
-
- a_stream << a_variable // any type
- << ends ; // null terminate string
-
- a_string = a_stream.str() ; // get the buffer
-
- a_stream.freeze(0) ; // unfreeze buffer
-
- return ( a_string ) ; // out of scope, deletes string
- // returns copy
- }
- --
- +--------------------------------------------------------------------+
- | Barry B. Floyd \\\ floydb1@rpi.edu |
- | RPI Alum. '84 '87 '88 \\\ |
- +--------------------------------------------------------------------+
-